/**
 * @file 用户账号管理接口
 */
import { get, post, uploadPost } from '@/api/request.ts';

const account = {
  // 获取短信验证码
  async getVerifyCode(params: any) {
    return await get('/client/sys/user/send-verify-code', params);
  },

  // 手机验证码注册或登录
  async signUpOrRegisterByVerifyCode(params: any) {
    return await post('/client/sys/user/register-login-by-verify-code', params);
  },

  // 账号密码登录
  async registerByPassword(params: any) {
    return await post('/client/sys/user/login-by-username', params);
  },

  // 登录页检查登录状态
  async checkLoginStatus() {
    return await get('/client/sys/user/check-login-status');
  },

  // 获取账号信息
  async getAccountInfo() {
    return await get('/client/sys/user/get-profile');
  },

  // 退出登录
  async logout() {
    return await get('/client/sys/user/logout');
  },

  // 上传图片
  async uploadImg(params: any) {
    return await uploadPost('/client/sys/user/upload-img-file', params);
  },

  // 修改个人信息
  async updateAccountInfo(params: any) {
    return await post('/client/sys/user/update-profile', params);
  },

  // 重置密码
  async resetPassword(params: any) {
    return await post('/client/sys/user/reset-password', params);
  },

  // 检查 换绑手机号
  async checkNewPhone(params: any) {
    return await get('/client/sys/user/check-before-change-phone-num', params);
  },

  // 换绑手机号
  async updatePhone(params: any) {
    return await post('/client/sys/user/change-phone-num', params);
  },
};

export default account;
